<!--
 * @Author: your name
 * @Date: 2020-08-22 01:51:42
 * @LastEditTime: 2020-08-23 22:29:45
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \exam-list\src\components\Nav\Nav.vue
-->
<template>
  <div class="nav">
    <Menu
      theme="dark"
      width="200"
      accordion
    >
      <template v-for="item in navigationList" >
        <Submenu v-if='item.title' :key="item.id" :name="item.id">
        <template slot="title">
          <Icon :type="item.icon" />
          {{item.title}}
        </template>
        <template v-for="submenu in item.children">
          <MenuItem
            v-if="submenu.title"
            :key="submenu.id"
            :name="submenu.id"           :to="`${filterRoute[0].path}/${item.path}/${submenu.path}`"
          >{{submenu.title}}</MenuItem>
        </template>
      </Submenu>
      </template>
    </Menu>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  name: 'leftnav',
  data () {
    return {
      // 左侧侧边栏
      navigationList: []
    }
  },
  computed: {
    ...mapState('GetAuth', ['filterRoute'])
  },
  mounted () {
    this.navigationList = this.filterRoute[0].children
  }
}
</script>
<style lang="scss" scoped>
.ivu-layout-sider a {
  padding-left: 56px !important;
}
</style>
